//
//  SettingTableViewController.m
//  新浪微博
//
//  Created by hbl on 16/3/9.
//  Copyright © 2016年 hbl. All rights reserved.
//

#import "SettingTableViewController.h"
#import "NextTempTableViewController.h"
#import "GeneralsettingTableViewController.h"
@interface SettingTableViewController ()

@end

@implementation SettingTableViewController

- (void)group1
{
    BLGroup *group1 = [[BLGroup alloc]init];
    BLItem *manage = [BLItem ItemWithTitle:@"账号管理" subTitle:@"" icon:nil number:@"new" option:nil destClass:[NextTempTableViewController class] type:BLItemTypeArrow];
    
    group1.Items = @[manage];
    [self.groups addObject:group1];
}

- (void)group2
{
    BLGroup *group2 = [[BLGroup alloc]init];
    BLItem *background = [BLItem ItemWithTitle:@"主题、背景" subTitle:@"" icon:nil number:@"" option:nil destClass:[NextTempTableViewController class] type:BLItemTypeArrow];
    
    group2.Items = @[background];
    [self.groups addObject:group2];
}

- (void)group3
{
    BLGroup *group3 = [[BLGroup alloc]init];
    BLItem *notifation = [BLItem ItemWithTitle:@"通知和提醒" subTitle:nil icon:nil number:nil option:nil destClass:[NextTempTableViewController class] type:BLItemTypeArrow];
    BLItem *setting = [BLItem ItemWithTitle:@"通用设置" subTitle:nil icon:nil number:nil option:nil destClass:[GeneralsettingTableViewController class] type:BLItemTypeArrow];
    BLItem *save = [BLItem ItemWithTitle:@"隐私与安全" subTitle:nil icon:nil number:nil option:nil destClass:[NextTempTableViewController class] type:BLItemTypeArrow];
    group3.Items = @[notifation,setting,save];
    [self.groups addObject:group3];
}

- (void)group4
{
    BLGroup *group4 = [[BLGroup alloc]init];
   BLItem *feedback = [BLItem ItemWithTitle:@"意见反馈" subTitle:nil icon:nil number:nil option:nil destClass:[NextTempTableViewController class] type:BLItemTypeArrow];
    BLItem *about = [BLItem ItemWithTitle:@"关于微博" subTitle:nil icon:nil number:nil option:nil destClass:[NextTempTableViewController class] type:BLItemTypeArrow];
    group4.Items = @[feedback,about];
    [self.groups addObject:group4];
}




- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"设置";
    [self group1];
    [self group2];
    [self group3];
    [self group4];
    
   }

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    [self setupBottomButton];
}

- (void)setupBottomButton
{
    UIButton *bottom = [[UIButton alloc]init];
    UIImage *bottomImage = [UIImage imageNamed:@"common_button_big_red_os7"];
    bottomImage = [bottomImage resizableImageWithCapInsets:UIEdgeInsetsMake(bottomImage.size.height * 0.5, bottomImage.size.width * 0.5, bottomImage.size.height * 0.5, bottomImage.size.width * 0.5)];

    UIImage *bottomImageheighlight = [UIImage imageNamed:@"common_button_big_red_highlighted_os7"];
    bottomImageheighlight = [bottomImageheighlight resizableImageWithCapInsets:UIEdgeInsetsMake(bottomImageheighlight.size.height * 0.5, bottomImageheighlight.size.width * 0.5, bottomImageheighlight.size.height * 0.5, bottomImageheighlight.size.width * 0.5)];
    [bottom setTitle:@"退出当前账号" forState:UIControlStateNormal];
    [bottom setBackgroundImage:bottomImage forState:UIControlStateNormal];
    [bottom setBackgroundImage:bottomImageheighlight forState:UIControlStateHighlighted];
    bottom.frame = CGRectMake(5, 40, [UIScreen mainScreen].bounds.size.width - 10, 50);
    
    [bottom addTarget:self action:@selector(exit) forControlEvents:UIControlEventTouchUpInside];
    
    UIView *footer = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 0, bottom.frame.size.height + 60)];
    
    self.tableView.tableFooterView = footer;
    [footer addSubview:bottom];
   
}

- (void)exit
{
    NSLog(@"退出当前账号");
}

@end
